package com.shiku.staticstic.controller.admin;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.shiku.staticstic.controller.AbstractController;
import com.shiku.staticstic.service.Response;
import com.shiku.staticstic.service.admin.AdminService;

@Controller
@RequestMapping(value="/admin")
public class AdminController extends AbstractController {
	
	private static final Logger log = LoggerFactory.getLogger(AdminController.class);
	
	@Autowired
	private AdminService adminService;
	
	@RequestMapping(value="/login", method=RequestMethod.POST)
	public void login(HttpServletRequest request, HttpServletResponse response, @RequestParam("uname") String uname, @RequestParam("password") String password){
		log.debug("login uname {} password {}", uname, password);
		Response responseData = adminService.login(uname, password);
		out(response, responseData);
	}
	
}
